<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017-08-14
 * Time: 16:08
 */

namespace app\api\model;

use think\Model;

class SmsLogModel extends Model
{
    // 确定链接表名
    protected $table = 'xl_sms_log';
//   执行 添加
    public function addLog($mobile, $msg)
    {
        $log_data = array();
        $log_data['mobile'] = $mobile;
        $log_data['smsbody'] = $msg;
        $log_data['status'] = 1;
        $log_data['create_time'] = $log_data['update_time'] = time();
        if ($this->save($log_data)) {
            return $this->id;
        } else {
            return false;
        }
    }

//    修改
    public function updateLog($logid, $status, $result, $result_desc)
    {
        $up_data = array();
        $up_data['id'] = $logid;
        $up_data['status'] = $status;
        $up_data['result'] = $result;
        $up_data['result_desc'] = $result_desc;
        $up_data['update_time'] = $up_data['send_time'] = time();
        if ($this->save($up_data)) {
            return true;
        } else {
            return false;
        }
    }


}